#ifndef DBFILE_H
#define DBFILE_H

#include "TwoWayList.h"
#include "Record.h"
#include "Schema.h"
#include "File.h"
#include "Comparison.h"
#include "ComparisonEngine.h"
#include "BigQ.h"
#include "GenericDBFile.h"
#include "HeapDBFile.h"
#include "SortedDBFile.h"

#ifndef FTYPE_
#define FTYPE_
typedef enum {heap, sorted, tree} fType;
#endif

class HeapDBFile;
class SortedDBFile;
class GenericDBFile;

#ifndef SORTINFO_
#define SORTINFO_
struct SortInfo {
	OrderMaker *myOrder;
	int runLength;
};
#endif

// stub DBFile header..replace it with your own DBFile.h 
class DBFile {

private:
	OrderMaker* setOrder;
	string file_type;
public:
	GenericDBFile *genDBFile;
	struct SortInfo* mySortInfo;

	DBFile (); 
	~DBFile();
	int Create (char *fpath, fType file_type, void *startup);
	int Open (char *fpath);
	int Close ();

	void Load (Schema &myschema, char *loadpath);

	void MoveFirst ();
	void Add (Record &addme);
	int GetNext (Record &fetchme);
	int GetNext (Record &fetchme, CNF &cnf, Record &literal);

};
#endif
